<?php
declare(strict_types=1);

namespace WebApp\lib\exception;

use Exception;
use Throwable;
use txz\common\base\utils\LogHelper;
use txz\common\base\utils\MonitorHelper;
use WebApp\lib\util\Util;

/**
 * Class ParamErrorException
 * @package txz\common\third_lib\model\exception
 */
class QuitException extends Exception
{
    public function __construct(string $tag = '', $why = '', int $code = 0, Throwable $previous = null)
    {
        $message = $tag . ":" . is_array($why)? json_encode($why):$why;
        if ($message) {
            Util::logE($message);
        }
        if ($tag) {
            MonitorHelper::monitorFatal($tag);
        }

        parent::__construct($message, $code, $previous);
    }
}